//package com.cx.ucenter.ctrl.avtivemq;
//
//import com.cx.common.utils.JsonUtils;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.AllArgsConstructor;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.jms.core.JmsMessagingTemplate;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import javax.annotation.Resource;
//import javax.jms.Queue;
//import java.util.function.Supplier;
//
///**
// * @Author:chenxiaoyi
// * @Date:2019/11/25 16:18
// */
//@Api(value = "MyController")
//@AllArgsConstructor
//@Controller
//public class MyController {
//
//    @Resource
//    private JmsMessagingTemplate jmsMessagingTemplate;
//    //注入存放消息的队列，用于下列方法一
//
//    @Qualifier("stringQueue")
//    @Resource
//    Queue stringQueue;
//
//    @Qualifier("objectQueue")
//    @Resource
//    Queue objectQueue;
//
//
//
//
//    @ApiOperation(value="index方法",tags={"测试返回json"},notes="注意问题点")
//    @PostMapping("/index")
//    @ResponseBody
//    public String index(){
////        jmsMessagingTemplate.convertAndSend(stringQueue,"这里发送一条string消息---1.0.0");
//        return "success";
//    }
//    @PostMapping("/index1")
//    @ResponseBody
//    public Order index1(@RequestBody Order order){
////        jmsMessagingTemplate.convertAndSend(stringQueue,"这里发送一条string消息---1.0.0");
//        return order;
//    }
//
//    @GetMapping("/index1")
//    @ResponseBody
//    public String object(){
//        jmsMessagingTemplate.convertAndSend(objectQueue, JsonUtils.object2String(new Order("1001",1L,"测试")));
//        this.exceTime(()->jmsMessagingTemplate.getConnectionFactory());
//        return "success1";
//    }
//
//
//    private void exceTime(Supplier<?> supplier){
//        long start = System.currentTimeMillis();
//        supplier.get();
//        System.out.println("消耗时间:---"+(System.currentTimeMillis() - start));
//    }
//
//}
